
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 02/17/2015 09:47:16
-- Generated from EDMX file: D:\Documents\Visual Studio 2013\Projects\Big Data\Big Data\Big Data\Entities\Sante.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Offres_facteurs];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'DepenseSanteChargePatientSet'
CREATE TABLE [dbo].[DepenseSanteChargePatientSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Valeurs] nvarchar(max)  NOT NULL,
    [DateSanteId] int  NOT NULL,
    [PaysSanteId] int  NOT NULL
);
GO

-- Creating table 'PaysSanteSet'
CREATE TABLE [dbo].[PaysSanteSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Pays] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'DateSanteSet'
CREATE TABLE [dbo].[DateSanteSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Date] nvarchar(max)  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'DepenseSanteChargePatientSet'
ALTER TABLE [dbo].[DepenseSanteChargePatientSet]
ADD CONSTRAINT [PK_DepenseSanteChargePatientSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PaysSanteSet'
ALTER TABLE [dbo].[PaysSanteSet]
ADD CONSTRAINT [PK_PaysSanteSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'DateSanteSet'
ALTER TABLE [dbo].[DateSanteSet]
ADD CONSTRAINT [PK_DateSanteSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [DateSanteId] in table 'DepenseSanteChargePatientSet'
ALTER TABLE [dbo].[DepenseSanteChargePatientSet]
ADD CONSTRAINT [FK_DateSanteDepenseSanteChargePatient]
    FOREIGN KEY ([DateSanteId])
    REFERENCES [dbo].[DateSanteSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_DateSanteDepenseSanteChargePatient'
CREATE INDEX [IX_FK_DateSanteDepenseSanteChargePatient]
ON [dbo].[DepenseSanteChargePatientSet]
    ([DateSanteId]);
GO

-- Creating foreign key on [PaysSanteId] in table 'DepenseSanteChargePatientSet'
ALTER TABLE [dbo].[DepenseSanteChargePatientSet]
ADD CONSTRAINT [FK_PaysSanteDepenseSanteChargePatient]
    FOREIGN KEY ([PaysSanteId])
    REFERENCES [dbo].[PaysSanteSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_PaysSanteDepenseSanteChargePatient'
CREATE INDEX [IX_FK_PaysSanteDepenseSanteChargePatient]
ON [dbo].[DepenseSanteChargePatientSet]
    ([PaysSanteId]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------